package com.hospital.yygh.task.scheduled;


import com.hospital.yygh.common.constant.MqConst;
import com.hospital.yygh.common.service.RabbitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 定时任务
 */
@Component
@EnableScheduling
public class ScheduledTask {

    @Autowired
    private RabbitService rabbitService;

    /**
     * 每天8点执行方法，就医提醒
     * corn表达式，设置执行间隔 0/30每30s执行一次(演示，实际用下面那个0 0 8 * * ?)
     * 0 0 8 * * ?
     */
    @Scheduled(cron = "0/30 * * * * ?")
    public void taskPatient() {
        rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK, MqConst.ROUTING_TASK_8, "");
    }


}
